import {Component, Inject, OnInit} from '@angular/core';
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';

@Component({
  selector: 'app-deregister-dialog',
  templateUrl: './deregister-dialog.component.html',
  styleUrls: ['./deregister-dialog.component.scss']
})
export class DeregisterDialogComponent {
  input = '';

  get yesBtnEnabled() {
    return this.input === this.data;
  }

  constructor(
    public dialogRef: MatDialogRef<DeregisterDialogComponent>,
    @Inject(MAT_DIALOG_DATA) public data: string
  ) {
  }

  onNoClick() {
    this.dialogRef.close(false);
  }

  onYesClick() {
    if (this.yesBtnEnabled) {
      this.dialogRef.close(true);
    }
  }
}
